//用户相关接口的管理
import $http from '@/service/request.js'

//登录，传入账号密码进行核实
//接口：/users/login
//POST
export const _login = ({account_user,password_user}) =>{
	return $http.request({
		url:'/users/login',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			password_user
		}
	})
}


//获取账号信息
//接口：/_getuserinfo
//GET
export const _getuserinfo = ({account_user,password_user}) =>{
	return $http.request({
		url:'/users/getinfo',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			password_user
		}
	})
}

//发送登录验证码
//接口：/users/tencent/logincode
//POST
export const _logincode = ({account_user}) =>{
	return $http.request({
		url:'/users/tencent/logincode',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user
		}
	})
}

//注册：验证码检测
//接口： /users/register/isok
//POST
export const _register = ({account_user,verifyCode}) =>{
	return $http.request({
		url:'/users/register/isok',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			verifyCode
		}
	})
}

//登录：验证码检测
//接口： /users/login/isok
//POST
export const _loginenter = ({account_user,verifyCode}) =>{
	return $http.request({
		url:'/users/login/isok',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			verifyCode
		}
	})
}

//发送注册验证码
//接口：/users/tencent/registercode
//POST
export const _registercode = ({account_user}) =>{
	return $http.request({
		url:'/users/tencent/registercode',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user
		}
	})
}

//注册新用户
//接口：/users/register
//POST
export const _register2 = ({name_user,nickname_user,account_user,gender_user,password_user}) =>{
	return $http.request({
		url:'/users/register',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			name_user,
			nickname_user,
			account_user,
			gender_user,
			password_user
		}
	})
}


//修改账号信息：如昵称
//接口：/users/modify
//PUT
export const _modifyname = ({account_user,nickname_user,photo_user}) =>{
	return $http.request({
		url:'/users/modify',
		method:'PUT',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			nickname_user,
			photo_user
		}
	})
}

//修改账号信息：如实验室位置
//接口：/users/modify
//PUT
export const _modifylabolocation = ({account_user,laboratorylocation_user}) =>{
	return $http.request({
		url:'/users/modify',
		method:'PUT',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			laboratorylocation_user
		}
	})
}

//根据用户账号owner(实验室拥有者)修改实验室
//接口：/lab/modifyLab
//PUT
export const _modifylaboloname = ({owner,name}) =>{
	return $http.request({
		url:'/lab/modifyLab',
		method:'PUT',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			owner,
			name
		}
	})
}

// //功能：获取用户实验室信息
// //接口：/users/laboratory
// //POST
// export const _labomanage = ({account_user}) =>{
// 	return $http.request({
// 		url:'/users/laboratory',
// 		method:'POST',
// 		header:{
// 			"Content-Type":"application/json"
// 		},
// 		data:{
// 			account_user
// 		}
// 	})
// }

//功能：查询用户账号user(实验室使用者)实验室
//接口：/lab/findLab
//POST
export const _labomanage = ({user}) =>{
	return $http.request({
		url:'/lab/findLab',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			user
		}
	})
}


//功能：修改账号信息：如密码、头像等
//接口：/users/modify
//PUT
export const _modify = ({account_user,password_user}) =>{
	return $http.request({
		url:'/users/modify',
		method:'PUT',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			password_user
		}
	})
}
//功能：密码修改：验证码检测
//接口：/users/paschange/isok
//POST
export const _isok = ({account_user,verifyCode}) =>{
	return $http.request({
		url:'/users/paschange/isok',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			verifyCode
		}
	})
}

//功能：发送密码修改验证码
//接口：/users/tencent/paschangecode
//POST
export const _paschangecode = ({account_user}) =>{
	return $http.request({
		url:'/users/tencent/paschangecode',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user
		}
	})
}